package com.nccsjz.pojo;

import java.util.List;

/**
 * Vote类用于封装选票信息
 * 
 * @author jason
 *
 */
public class Vote {

	/** voteId 选票编号 **/
	private Long voteId;
	
	/** voteTitle 选票题干 **/
	private String title;
	
	/** state 选中状态:0代表未选中 ，1代表选中 */
	private int state;
	
	/** answers 选票答案*/
	private List<VoteAnswer> answers;
	

	public Long getVoteId() {
		return voteId;
	}

	public void setVoteId(Long voteId) {
		this.voteId = voteId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public List<VoteAnswer> getAnswers() {
		return answers;
	}

	public void setAnswers(List<VoteAnswer> answers) {
		this.answers = answers;
	}
	
	/**
	 * 取得选票答案数量
	 * 
	 * @return
	 */
	public int getAnswersCount(){
		return answers == null?0:answers.size();
	}
	
	/**
	 * getTotalClickCount方法用于获取总票数
	 * 
	 * @return
	 */
	public long getTotalClickCount(){
		long sum = 0;
		for(VoteAnswer an :answers){
			sum += an.getClickCount();
		}
		return sum;
	}
}
